package com.yukefms.rule.formula.interfaces;

import com.yukefms.engine.running.MatchedStatus;
import com.yukefms.engine.running.RunningContext;
import com.yukefms.jointpoint.BodyPointCloud;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Description the base class for all sorts of rule, defines all basic properties and methods.
 * @Author Ping
 * @Date 2021/6/16 1:01
 **/
public abstract class AbstractStaticBAFormula implements StaticBAFormula {

    protected String actionName ;
    protected double score = 0.0;
    protected String actionDescription ;

    /**
     * related joint types in the formula
     */
    protected List<String> jointTypes ;
    /**
     * next formula for current formula.
     */
    protected StaticBAFormula successor ;

    public AbstractStaticBAFormula() {
        this.jointTypes = new ArrayList<>() ;
    }
    public AbstractStaticBAFormula(String ... jointTypes) {
        this.jointTypes = new ArrayList<String>() ;
        this.jointTypes.addAll(Arrays.asList(jointTypes));
    }
    public AbstractStaticBAFormula(String actionName, double score, String... jointTypes) {
        this(jointTypes) ;
        this.actionName = actionName ;
        this.score = score ;
    }
    public AbstractStaticBAFormula(String actionName, String actionDescription, double score, String... jointTypes) {
        this(jointTypes) ;
        this.actionName = actionName ;
        this.score = score ;
        this.actionDescription = actionDescription ;
    }


    @Override
    public List<String> relatedJointTypes() {
        return this.jointTypes;
    }
    @Override
    public void setSuccessor(StaticBAFormula formula) {
        this.successor = formula ;
    }

    @Override
    public StaticBAFormula getSuccessor() {
        return this.successor;
    }

    @Override
    public MatchedStatus matched(BodyPointCloud bodyPointCloud, RunningContext context) {
        return null;
    }

    @Override
    public String getName() {
        return this.actionName;
    }

    @Override
    public void setName(String actionName) {
        this.actionName = actionName ;
    }

    @Override
    public void setScore(double score) {
        this.score = score ;
    }

    @Override
    public double getScore() {
        return this.score;
    }

    @Override
    public String getDescription() {
        return this.actionDescription;
    }

    @Override
    public void setDescription(String description) {
        this.actionDescription = description ;
    }
}



